package com.starryx.sim.mvc.net.handler;


import com.starryx.sim.mvc.net.handler.impl.GetMethodHandler;
import com.starryx.sim.mvc.net.handler.impl.PostMethodHandler;
import io.netty.handler.codec.http.HttpMethod;

import java.util.HashMap;
import java.util.Map;


public class RequestHandlerFactory {

	private static final Map<HttpMethod, RequestHandler> REQUEST_HANDLERS = new HashMap<>();

	static {
		REQUEST_HANDLERS.put(HttpMethod.GET, new GetMethodHandler());
		REQUEST_HANDLERS.put(HttpMethod.POST, new PostMethodHandler());
	}

	public static RequestHandler create(HttpMethod httpMethod) {
		return REQUEST_HANDLERS.get(httpMethod);
	}

}
